import type { listQuery } from '@/types/requestTypes';
import request from './request';
import type { AjaxResult } from '@/types/resultTypes';
// 提交入驻申请
export function residencyApplication(query: any) {
  return request({
    url: '/kjy/application',
    method: 'post',
    data: query,
  });
}
// 获取入驻申请列表
export function residencyApplicationList(query: any) {
  return request({
    method: 'get',
    url: '/kjy/application/list',
    params: query,
  });
}
// 获取我提交的入驻申请
export function residencyApplicationDetail(id: string) {
  return request({
    method: 'get',
    url: '/kjy/application/' + id,
  });
}
// 修改入驻申请表
export function editResidencyApplication(query: any) {
  return request({
    method: 'put',
    url: '/kjy/application',
    data: query,
  });
}
// 删除入驻申请
export function delApplication(id: string) {
  return request({
    url: '/kjy/application/' + id,
    method: 'delete',
  });
}

// 获取企业列表
export function enterpriseList(query: any) {
  return request({
    url: '/kjy/enterprise/list',
    method: 'get',
    params: query,
  });
}
// 添加企业
export function enterprisePost(query: any) {
  return request({
    url: '/kjy/enterprise',
    method: 'post',
    data: query,
  });
}
// 编辑企业信息
export function enterprisePut(query: any) {
  return request({
    url: '/kjy/enterprise',
    method: 'put',
    data: query,
  });
}
// 获取企业详情信息
export function enterpriseDetail(id: number) {
  return request({
    url: '/kjy/enterprise/' + id,
    method: 'get',
  });
}
// 获取高企认定的条件和好处
export function highTechEnterprisesInfoList(query: any) {
  return request({
    url: '/kjy//hightechenterprisesinfo/list',
    method: 'get',
    params: query,
  });
}

// 提交高企入库申请
export function storageApplication(query: any) {
  return request({
    url: '/kjy/storageApplication',
    method: 'post',
    data: query, 
  });
}
// 获取高企入库申请列表
export function storageApplicationList(query: any) {
  return request({
    method: 'get',
    url: '/kjy/storageApplication/list',
    params: query,
  });
}
// 获取我提交的高企入库申请
export function storageApplicationDetail(id: string) {
  return request({
    method: 'get',
    url: '/kjy/storageApplication/' + id,
  });
}
// 修改高企入库申请表
export function editStorageApplication(query: any) {
  return request({
    method: 'put',
    url: '/kjy/storageApplication',
    data: query,
  });
}
// 删除高企入库申请
export function delStorageApplication(id: number) {
  return request({
    url: '/kjy/storageApplication/' + id,
    method: 'delete',
  });
}


// 众创空间入驻申请(学生,教师,团队,用type区分)
export function zcresidencyApplication(query: any) {
  return request({
    url: '/kjy/createSpace',
    method: 'post',
    data: query,
  });
}
//根据id获取入驻申请(学生和老师接口)
export function getApplicationFromId(id:any){
  return request({
    url: `/kjy/createSpace/${id}`,
    method: 'get',
  });
}
//根据ids删除入驻申请(学生和老师接口)
export function delApplicationFromIds(ids:any){
  return request({
    url: `/kjy/createSpace/${ids}`,
    method: 'delete',
  });
}


//获取我的入驻申请(学生和老师接口)
export function getMyApplicationList(){
  return request({
    url: '/kjy/createSpace/my',
    method: 'get',
  });
}
//修改入驻申请(学生和老师接口)
export function editApplication(query:any){
  return request({
    url: '/kjy/createSpace',
    method: 'put',
    data: query,
  });
}
//获取入驻申请列表(学生和老师接口)
export function getApplicationList(query:listQuery){
  return request({
    url: '/kjy/createSpace/list',
    method: 'get',
    params: query,
  });
}


// 新建入驻申请(迁入企业接口)
export function newImmigrantApplication(query: any) {
  return request({
    url: '/kjy/migrationenterprise',
    method: 'post',
    data: query,
  });
}

// 获取入驻申请列表(迁入企业接口)
export function getImmigrantApplicationList(query:listQuery){
  return request({
    url: '/kjy/migrationenterprise/list',
    method: 'get',
    params: query,
  });
}

// 获取入驻申请详情(迁入企业接口)
export function getImmigrantApplicationDetail(id: any){
  const timestamp = new Date().getTime();
  // 确保ID是字符串格式，BigInt需要转换为字符串
  const idString = typeof id === 'bigint' ? id.toString() : String(id);
  return request({
    url: `/kjy/migrationenterprise/${idString}`,
    method: 'get',
    params: { _t: timestamp } // 添加时间戳防止缓存
  });
}
//获取我的入驻申请(迁入企业)
export function getMyImmigrantApplicationList(){
  return request({
    url: '/kjy/migrationenterprise/my',
    method: 'get',
  });
}

// 修改入驻申请(迁入企业接口)
export function editImmigrantApplication(query:any){
  return request({
    url: '/kjy/migrationenterprise',
    method: 'put',
    data: query,
  });
}

// 删除入驻申请(迁入企业接口)
export function delImmigrantApplication(id: string) {
  return request({
    url: `/kjy/migrationenterprise/${id}`,
    method: 'delete',
  });
}


// 新建入驻申请(新成立企业接口)
export function NewEnterpriseApplication<T>(query:any):Promise<AjaxResult<T>>{
  return request({
    url: '/kjy/newEnterprise',
    method: 'post',
    data: query,
  });
}
// 获取入驻申请列表(新成立企业接口)
export function getEnterpriseApplicationList(query:listQuery){
  return request({
    url: '/kjy/newEnterprise/list',
    method: 'get',
    params: query,
  });
}
// 获取入驻申请详情(新成立企业接口)
export function getEnterpriseApplicationDetail(id:any){
  return request({
    url: `/kjy/newEnterprise/${id}`,
    method: 'get',
  });
}
//获取我的入驻申请(新成立企业)
export function getMyEnterpriseApplicationList(){
  return request({
    url: '/kjy/newEnterprise/my',
    method: 'get'
  });
}
// 修改入驻申请(新成立企业接口)
export function editEnterpriseApplication(query:any){
  return request({
    url: '/kjy/newEnterprise',
    method: 'put',
    data: query,
  });
}

// 删除入驻申请(新成立企业接口)
export function delEnterpriseApplication(id: string) {
  return request({
    url: `/kjy/newEnterprise/${id}`,
    method: 'delete',
  });
}



// 查询活动列表
export function listEnterpriseActivity(query:any) {
  return request({
    url: "/kjy/enterpriseActivity/list",
    method: "get",
    params: query,
  });
}

// 查询活动详细
export function getEnterpriseActivity(id:any) {
  return request({
    url: "/kjy/enterpriseActivity/" + id,
    method: "get",
  });
}

// 报名活动
export function attendEnterpriseActivity(query:any) {
  return request({
    url: 'kjy/attendActivity/attend',
    method: 'post',
    data: query,
  });
}

//查看我的报名活动
export function getAttendEnterpriseActivity(query:any) {
  return request({
    url: '/kjy/attendActivity/list/my',
    method: 'get',
    params: query,
  });
}

//获取服务机构列表
export function getServiceOrganizationList(query:any) {
  return request({
    url: '/kjy/serviceAgency/list',
    method: 'get',
    params: query,
  });
}

//根据id获取服务机构详情
export function getServiceOrganizationDetail(id:any) {
  return request({
    url: '/kjy/serviceAgency/' + id,
    method: 'get'
  });
}
//获取服务类型
export function getServiceTypeList() {
  return request({
    url: '/system/dict/data/type/service_category',
    method: 'get'
  });
}


//数据填报
// 大学科技园数据填报提交
export function AddDataSCience(query: any) {
  return request({
    url: '/kjy/ScienceYearForm',
    method: 'post',
    data: query,
  });
}
//获取我的大学科技园填报列表
export function getMyDataSCienceList(){
  return request({
    url: '/kjy/ScienceYearForm/my',
    method: 'get'
  });
}
// 根据获取大学科技园数据填报
export function GetDataSCienceByid(id: any) {
  return request({
    url: `/kjy/ScienceYearForm/${id}`,
    method: 'get',
  });
}
// 获取用户大学科技园数据填报
export function GetUserDataSCience(query: any) {
  return request({
    url: '/kjy/ScienceYearForm/listByUserId',
    method: 'get',
    params: query,
  });
}
// 更新用户大学科技园数据填报
export function UpdataUserDataSCience(query: any) {
  return request({
    url: '/kjy/ScienceYearForm',
    method: 'put',
    data: query,
  });
}
// 删除大学科技园数据填报
export function delDataSCience(id: string) {
  return request({
    url: `/kjy/ScienceYearForm/${id}`,
    method: 'delete',
  });
}
// zongchuang数据填报提交
export function AddDatazongchuang(query: any) {
  return request({
    url: '/kjy/EnterpriseDataFrom',
    method: 'post',
    data: query,
  });
}
//获取我的众创空间填报列表
export function getDatazongchuang(){
  return request({
    url: '/kjy/EnterpriseDataFrom/my',
    method: 'get'
  });
}
// 根据获取id众创空间填数据填报
export function GetDatazongchuangyid(id: any) {
  return request({
    url: `/kjy/EnterpriseDataFrom/${id}`,
    method: 'get',
  });
}
// 获取用户zongchuang数据填报
export function GetUserDatazongchuang(query: any) {
  return request({
    url: '/kjy/EnterpriseDataFrom/listByUserId',
    method: 'get',
    params: query,
  });
}
// 更新用户zongchuang数据填报
export function UpdataUserDatazongchuang(query: any) {
  return request({
    url: '/kjy/EnterpriseDataFrom',
    method: 'put',
    data: query,
  });
}
// 删除zongchuang数据填报
export function delDatazongchuang(id: string) {
  return request({
    url: `/kjy/EnterpriseDataFrom/${id}`,
    method: 'delete',
  });
}
  // 孵化器年度数据填报提交
  export function AddDataHatchYear(query: any) {
    return request({
      url: '/kjy/HatchYearDataFrom',
      method: 'post',
      data: query,
    });
  }

//获取孵化器年度填报列表
  export function getDataHatchYear() {
    return request({
      url: '/kjy/HatchYearDataFrom/my',
      method: 'get'
    });
  }

// 根据获取id孵化器年度数据填报
  export function GetDataHatchYearid(id: any) {
    return request({
      url: `/kjy/HatchYearDataFrom/${id}`,
      method: 'get',
    });
  }

// 获取用户孵化器年度数据填报
  export function GetUserDataHatchYear(query: any) {
    return request({
      url: '/kjy/HatchYearDataFrom/listByUserId',
      method: 'get',
      params: query,
    });
  }

// 更新用户孵化器年度数据填报
  export function UpdataUserDataHatchYear(query: any) {
    return request({
      url: '/kjy/HatchYearDataFrom',
      method: 'put',
      data: query,
    });
  }

// 删除孵化器年度数据填报
  export function delDataHatchYear(id: string) {
    return request({
      url: `/kjy/HatchYearDataFrom/${id}`,
      method: 'delete',
    });
  }
// 孵化器年度数据填报提交
export function AddDataHatchQuarter(query: any) {
  return request({
    url: '/kjy/HatchQuarterDataFrom',
    method: 'post',
    data: query,
  });
}
//获取孵化器季度填报列表
export function getDataHatchQuarter() {
  return request({
    url: '/kjy/HatchQuarterDataFrom/my',
    method: 'get'
  });
}

// 根据获取id孵化器季度数据填报
export function GetDataHatchQuarterid(id: any) {
  return request({
    url: `/kjy/HatchQuarterDataFrom/${id}`,
    method: 'get',
  });
}

// 获取用户孵化器季度数据填报
export function GetUserDataHatchQuarter(query: any) {
  return request({
    url: '/kjy/HatchQuarterDataFrom/listByUserId',
    method: 'get',
    params: query,
  });
}

// 更新用户孵化器季度数据填报
export function UpdataUserDataHatchQuarter(query: any) {
  return request({
    url: '/kjy/HatchQuarterDataFrom',
    method: 'put',
    data: query,
  });
}

// 删除孵化器季度数据填报
export function delDataHatchQuarter(id: string) {
  return request({
    url: `/kjy/HatchQuarterDataFrom/${id}`,
    method: 'delete',
  });
}
